Things don’t have to be useful to man (in a strictly utilitarian sense) to be created for us.
For example, we learn about things and explore and research them, which teaches us things that God wanted us to know. And then, we know more about just how wonderful and generous and creative God is, and we can praise Him more gratefully. A dog isn’t always “useful” in a job sense, but it is “useful” in teaching people to love and care, in cheering up people, and in many other ways.
Also, God creating all Creation for a purpose (ie, having a place for humans to live and to watch over, since angels are pure spirits and don’t need material Creation to live in or watch over) doesn’t stop Him from doing it for His glory or for pure love of creating things. It just means that He did have a purpose in mind for His loving act, and He wanted to show His glory to more than just the angels.
Footnote 222 points us to “Gaudium et Spes,” 12 § 1; 24 § 3; 39 § 1.
12 § 1: “According to the almost unanimous opinion of believers and unbelievers alike, all things on earth should be related to man as their center and crown.”
More to the point, a few paragraphs later it says, "For Sacred Scripture teaches that man was created “to the image of God,” is capable of knowing and loving his Creator, and was appointed by Him as master of all earthly creatures(1) that he might subdue them and use them to God’s glory.(2) “What is man that you should care for him? You have made him little less than the angels, and crowned him with glory and honor. You have given him rule over the works of your hands, putting all things under his feet” (Ps. 8:5-7).
Cf. Gen. 1:26, Wis. 2:23.
Cf. Sir. 17:3-10.
24 § 3: “Indeed, the Lord Jesus, when He prayed to the Father, “that all may be one. . . as we are one” (John 17:21-22) opened up vistas closed to human reason, for He implied a certain likeness between the union of the divine Persons, and the unity of God’s sons in truth and charity. This likeness reveals that man, who is the only creature on earth which God willed for Himself, cannot fully find himself except through a sincere gift of himself.(2)”
- Cf. Col. 3:2.
39 § 1: “Enduring with charity and its fruits,(20) all that creation(21) which God made on man’s account will be unchained from the bondage of vanity.”
The Vatican.va copy seems to have lost footnotes 20 and 21 of this chapter. The EWTN copy says:
Cf. 1 Cor. 13:8; 3:14.
Cf. Rom. 8:19-21.
Hope this helped!