Yes, to some extent its same for chess no? Why learn playing chess if computer is better at it? And yet...
I think writing and understanding code will not go away. But it will become more of a niche.
I am an Engineer and started writing code in 2000 in school. I do know of the fun you speak of.
But I am excited for this new AI wave.
There are some many things I want computers to do that they don't... I have backlogs of ideas in hundreds... And I will never have time to write them.
Ouh boy am I ecstatic about perspective to make AI write prototypes of those... I honestly always cared about value software brings then activity of coding itself.
But it does not work yet... I am actually excited about one thing. For a long time I wanted to enable teachers to convert home works in to games. Kids are showered by high quality experiences in form of books, tvs, games these days. No way to pay attention to dull and dry school stuff... At least not locally.
But how can teacher make a game? My wife helps at local school. She does want the same. Computer to help her to make school more interesting for kids... And yet it can't yet.
Currently it get's you 80% there if you know what and how to ask for. If you don't you will spend time going in circles with it.
And then you still will need to fix and finish remaining 20%.
I still think that some part of software engineering will stay. I think a fun part. Defining problem to be solved. It partially goes in to domains of UX and Product Management but still stays in technical domain. More like solo startup entrepreneurship with bunch of AI assistants. I don't know about you but that excites me.
Though AI can get to doing that too. I don't think we will have less fun. I think I will have more fun :D